﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Configuration;

namespace ProcessoSeletivo.DAO
{
    public class QuestaoCandidato : IDisposable
    {
        #region " Incluir "

        public void IncluirQuestaoCandidato(int num_questao_qca, char des_letra_qca, int cod_candidato_can)
        {
            using (SqlConnection sql = new SqlConnection(ConfigurationManager.ConnectionStrings["StringConexao"].ToString()))
            {
                sql.Open();
                SqlCommand sqlc = new SqlCommand("IncluirQuestaoCandidato", sql);
                sqlc.CommandType = CommandType.StoredProcedure;

                sqlc.Parameters.AddWithValue("@num_questao_qca", num_questao_qca);
                sqlc.Parameters.AddWithValue("@des_letra_qca", des_letra_qca);
                sqlc.Parameters.AddWithValue("@cod_candidato_can", cod_candidato_can);
                sqlc.ExecuteNonQuery();

                sql.Close();
            }
        }

        #endregion

        #region " Excluir "

        public void ExcluirQuestaoCandidato(int cod_candidato_can)
        {
            using (SqlConnection sql = new SqlConnection(ConfigurationManager.ConnectionStrings["StringConexao"].ToString()))
            {
                sql.Open();
                SqlCommand sqlc = new SqlCommand("ExcluirQuestaoCandidato", sql);
                sqlc.CommandType = CommandType.StoredProcedure;

                sqlc.Parameters.AddWithValue("@cod_candidato_can", cod_candidato_can);
                sqlc.ExecuteNonQuery();

                sql.Close();
            }
        }

        #endregion

        #region " Dipose "

        public void Dispose()
        {
            GC.SuppressFinalize(this);
        }

        #endregion
    }
}
